package projectincharge.view;

import inventory.reports.view.ReportsMainView;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.management.Notification;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SpringLayout;
import javax.swing.border.LineBorder;

import common.view.NotificationsView;

import viewframework.UIFrameWork;

public class ProjectInchargeMainView extends JPanel implements MouseListener
{
	private SpringLayout springLayout;
	private JSeparator separatorHeader;
	private JSeparator separatorFooter;
	private String[] labelNames;
	private JLabel[] headerMenu;

	public ProjectInchargeMainView()
	{
		setForeground(Color.WHITE);
		setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		setBackground(Color.WHITE);
		springLayout = new SpringLayout();
		setLayout(springLayout);
		
		separatorHeader = new JSeparator();
		separatorHeader.setForeground(Color.PINK);
		springLayout.putConstraint(SpringLayout.NORTH, separatorHeader, 100, SpringLayout.NORTH,this);
		springLayout.putConstraint(SpringLayout.WEST, separatorHeader, 0, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.EAST, separatorHeader, 0, SpringLayout.EAST,this);
		add(separatorHeader);
		//*************************************************************************************
		separatorFooter = new JSeparator();
		springLayout.putConstraint(SpringLayout.SOUTH, separatorFooter, -30, SpringLayout.SOUTH,this);
		springLayout.putConstraint(SpringLayout.WEST, separatorFooter, 0, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.EAST, separatorFooter, 0, SpringLayout.EAST,this);
		add(separatorFooter);
		//*************************************************************************************
		labelNames=new String[]{"Home","Inventory Reports","Notifications"};
		
		Dimension[]preferedSize={new Dimension(70, 30),new Dimension(230, 30),new Dimension(180, 30)};
		headerMenu=UIFrameWork.makeHeaderMenu(this, labelNames,50,2,0,preferedSize);
		
		Font font=new Font("MS Reference Sans Serif", Font.BOLD, 13);
		LineBorder border=new LineBorder(Color.PINK, 1, true);
		UIFrameWork.headerMenuStyling(headerMenu,Cursor.HAND_CURSOR,Color.WHITE, border,Color.PINK, font);
		
		UIFrameWork.addListeners(headerMenu,this);
	}
	
	@Override
	public void mouseClicked(MouseEvent e) 
	{
		JLabel label=(JLabel) e.getSource();
		String labelName=label.getText();
		
		if(labelName=="Home")
		{
			UIFrameWork.stickPanel(this,new JPanel(), 6);
		}
		
		if(labelName=="Inventory Reports")
		{
			ReportsMainView rmv=new ReportsMainView();
			UIFrameWork.stickPanel(this,rmv,6);
		}
		
		if(labelName=="Notifications")
		{
			NotificationsView nv=new NotificationsView();
			UIFrameWork.stickPanel(this,nv,6);
		}
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	
}
